package com.googlecode.jawb.tests.saving;

import static org.junit.Assert.assertArrayEquals;

import java.io.ByteArrayOutputStream;

import org.junit.Test;

import com.googlecode.jawb.JAWB;

public class Saving {
	@Test
	public void test() throws Exception {
		ByteArrayOutputStream expected	= new ByteArrayOutputStream();
		ByteArrayOutputStream real		= new ByteArrayOutputStream();
		
		expected.write(new byte[]{
			(byte) 0xAA,								// A.valA
			(byte) 0xAA, (byte) 0xBB, (byte) 0xCC,		// A.valB
			(byte) 0x0A, (byte) 0x0B, (byte) 0x0C,		// A.val_B
			
			(byte) 0x66, (byte) 0x77,					// A.valC
			
			(byte) 0x99, (byte) 0x88, (byte) 0x77, (byte) 0x66,
			
			(byte) 0x01, (byte) 0x03
		});
		
		new JAWB().saveTo(real, new Saving_A());
		assertArrayEquals(expected.toByteArray(), real.toByteArray());
	}
}
